import { getQueryParams } from '@/utils';
import http from './http';

export default {
  // 新增活动
  addActivity(params) {
    return http.post(`/mall/web/activity/v1/add`, params).exec();
  },
  // 活动删除
  deleteActivity(params) {
    return http.post(`/mall/web/activity/v1/delete`, params).exec();
  },
  // 删除活动明细商品
  deleteActivityProduct(params) {
    return http.post(`/mall/web/activity/v1/detail/delete`, params).exec();
  },
  // 活动详情
  getActivityInfo(params) {
    return http
      .get(`/mall/web/activity/v1/info?${getQueryParams(params)}`)
      .exec();
  },
  // 活动列表-分页查询
  getActivityList(params) {
    return http
      .get(`/mall/web/activity/v1/list?${getQueryParams(params)}`)
      .exec();
  },
  // 活动修改
  modifyActivity(params) {
    return http.post(`/mall/web/activity/v1/modify`, params).exec();
  },
  // 活动暂停或取消
  stopOrStartActivity(params) {
    return http.post(`/mall/web/activity/v1/stopOrStart`, params).exec();
  },
  // 根据名称搜索产品信息
  getProductItem(params) {
    return http
      .get(`/mall/web/product/v1/productItem?${getQueryParams(params)}`)
      .exec();
  },
};
